package portal.manager.data;

import java.beans.BeanDescriptor;
import java.beans.PropertyDescriptor;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.bsc.bean.BeanDescriptorEntity;
import static org.bsc.bean.BeanManagerUtils.joinProperties;
import static org.bsc.bean.BeanManagerUtils.EMPTY_PROPERTYDESCRIPTOR;
import org.bsc.bean.PropertyDescriptorField;

import portal.manager.data.Template.Variable;


/**
 * 
 * @author Sorrentino
 *
 */
public class PageVariableBeanInfo extends TemplateVariableBeanInfo {

	
	public PageVariableBeanInfo() {
		super( Page.Variable.class );
	}

	
	protected PageVariableBeanInfo(Class<? extends Variable> beanClass) {
		super(beanClass);
	}


	@Override
	public BeanDescriptor getBeanDescriptor() {
		return new BeanDescriptorEntity( getBeanClass(), "PAGE_VARIABLE" );
	}

	@Override
	public PropertyDescriptor[] getPropertyDescriptors() {

		try {
			return  joinProperties( super.getPropertyDescriptors(), 
									new PropertyDescriptorField( "VALUE", getBeanClass(), "getValue", "setValue")
										.setSize(20)
					);
		} catch (Exception e) {
			Logger.global.log(Level.WARNING, "PageVariable.getPropertyDescriptor() error", e);
		}
		
		return EMPTY_PROPERTYDESCRIPTOR;
	}


	
}
